<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<title>Lista Prodotti</title>
<style type="text/css">
			@import url("../travel.css");
			@import url("../user.css");
    	</style>
</h:head>
<h:body>
<ui:include src="headerAdmin.xhtml"/>
<div id='boxUserContainer'>
<h:form>
<h:outputText rendered="#{param['deleted']}" value="Prodotto eliminato con successo!"/>
</h:form>
<h:form>
<h:dataTable id="products"
                         value="#{tableBean.allProductsDTO}"
                         var="productDTO"
                         headerClass="list-header"
                         styleClass="list-background"
                         rowClasses="list-row-even, list-row-odd"
                         border="1">
  

                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Nome Prodotto"/>
                    </f:facet>
                    <h:commandLink
                    			   
                                   value="#{productDTO.nome}">
                                                     
                    </h:commandLink>
                </h:column>

                <h:column rendered = "#{param['logged']}">
                    <f:facet name="header">
                        <h:outputText value="Tipo"/>
                    </f:facet>
                    <h:outputText value="#{productDTO.tipo}"/>
                </h:column>

                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Elimina"/>
                    </f:facet>
                    <h:commandLink
                    			   action = "#{productInsertBean.elimina()}"
                                   value="Elimina">
                        <f:setPropertyActionListener target="#{productInsertBean.product}" 
                                                     value="#{productDTO}"/>
                                                  
                                                     
                    </h:commandLink>
                </h:column>
	
				<h:column>
                    <f:facet name="header">
                        <h:outputText value="Modifica"/>
                    </f:facet>
                    <h:commandLink
                    			   action = "#{productInsertBean.redirect()}"
                                   value="Modifica">
                        <f:setPropertyActionListener target="#{productInsertBean.product}" 
                                                     value="#{productDTO}"/>
                                                    
                    </h:commandLink>
                </h:column>

            </h:dataTable>
                                
            </h:form>
            </div>
           </h:body>
</html>